﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControls_LabelControl_Whir_Com : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Page.EnableViewState = EnableViewState;
        this.EnableViewState = EnableViewState;

        if (FileName != string.Empty)
        {            
            //组合标签
            string label = "<Whir:Com ID=\"{0}\" FileName=\"{1}\" Paras=\"{2}\"></Whir:Com>";
            label = string.Format(label, this.ID, this.FileName,this.Paras);

            string templete_com_path = Page.Server.MapPath(Whir.Common.Settings.GetString("SystemPath") + Whir.Common.Settings.GetString("templete_Com_Path"));

            Whir.Label.WHIR_COM whir_com = new Whir.Label.WHIR_COM(label, templete_com_path);

            this.Literal1.Text = whir_com.GetLabelCode();
        }
        else
        {
            this.Literal1.Text = "置标读到出错,请检查测试置标";
        }
    }

    private string _filename=string.Empty;
    private string _paras = string.Empty;
    /// <summary>
    /// 控件文件名,不用后缀,直指向目录UploadFiles\template\template_com
    /// </summary>
    public string FileName
    {
        get { return _filename; }
        set { _filename = value; }
    }

    /// <summary>
    /// 控件传值单值:ID:1,多值:ID:1|TypeID:2
    /// </summary>
    public string Paras
    {
        get { return _paras; }
        set { _paras = value; }
    }

    private bool _enableViewState = false;
    /// <summary>
    /// 页面EnableViewState启用状态
    /// </summary>
    public bool EnableViewState
    {
        get { return _enableViewState; }
        set { _enableViewState = value; }
    }
}
